<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>控制流 | Swift 简介</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.1.0">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
    

        
    
    
    <link rel="next" href="./05-loop.html" />
    
    
    <link rel="prev" href="./03-optional.html" />
    

        
    </head>
    <body>
        
        
    <div class="book" data-level="0.4" data-basepath="." data-revision="Fri Aug 28 2015 04:40:56 GMT+0800 (CST)">
    

<div class="book-summary">
    <div class="book-search">
        <input type="text" placeholder="Type to search" class="form-control" />
    </div>
    <ul class="summary">
        
        
        
        

        

        
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                        <i class="fa fa-check"></i>
                        
                        Swift快速入门
                    </a>
                
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="0.1" data-path="01-playground.html">
            
                
                    <a href="./01-playground.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.1.</b>
                        
                        Playground
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.2" data-path="02-var_and_let.html">
            
                
                    <a href="./02-var_and_let.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.</b>
                        
                        变量和常量
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.3" data-path="03-optional.html">
            
                
                    <a href="./03-optional.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.</b>
                        
                        Optional可选值
                    </a>
                
            
            
        </li>
    
        <li class="chapter active" data-level="0.4" data-path="04-control_flow.html">
            
                
                    <a href="./04-control_flow.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.4.</b>
                        
                        控制流
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.5" data-path="05-loop.html">
            
                
                    <a href="./05-loop.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.5.</b>
                        
                        循环
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.6" data-path="06-string.html">
            
                
                    <a href="./06-string.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.6.</b>
                        
                        字符串
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.7" data-path="07-collection.html">
            
                
                    <a href="./07-collection.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.7.</b>
                        
                        集合
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.8" data-path="08-func.html">
            
                
                    <a href="./08-func.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.8.</b>
                        
                        函数
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.9" data-path="09-closure.html">
            
                
                    <a href="./09-closure.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.9.</b>
                        
                        闭包
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.10" data-path="10-init_func.html">
            
                
                    <a href="./10-init_func.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.10.</b>
                        
                        构造函数
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.11" data-path="11-lazy.html">
            
                
                    <a href="./11-lazy.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.11.</b>
                        
                        懒加载 &amp; didSet
                    </a>
                
            
            
        </li>
    
        <li class="chapter " data-level="0.12" data-path="12-ats.html">
            
                
                    <a href="./12-ats.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.12.</b>
                        
                        ATS
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    


        
        <li class="divider"></li>
        <li>
            <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                Published with GitBook
            </a>
        </li>
        
    </ul>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header">
    <!-- Actions Left -->
    <a href="#" class="btn pull-left toggle-summary" aria-label="Table of Contents"><i class="fa fa-align-justify"></i></a>
    <a href="#" class="btn pull-left toggle-search" aria-label="Search"><i class="fa fa-search"></i></a>
    
    <div id="font-settings-wrapper" class="dropdown pull-left">
        <a href="#" class="btn toggle-dropdown" aria-label="Font Settings"><i class="fa fa-font"></i>
        </a>
        <div class="dropdown-menu font-settings">
    <div class="dropdown-caret">
        <span class="caret-outer"></span>
        <span class="caret-inner"></span>
    </div>

    <div class="buttons">
        <button type="button" id="reduce-font-size" class="button size-2">A</button>
        <button type="button" id="enlarge-font-size" class="button size-2">A</button>
    </div>

    <div class="buttons font-family-list">
        <button type="button" data-font="0" class="button">Serif</button>
        <button type="button" data-font="1" class="button">Sans</button>
    </div>

    <div class="buttons color-theme-list">
        <button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">White</button>
        <button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">Sepia</button>
        <button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">Night</button>
    </div>
</div>

    </div>

    <!-- Actions Right -->
    
    <div class="dropdown pull-right">
        <a href="#" class="btn toggle-dropdown" aria-label="Share"><i class="fa fa-share-alt"></i>
        </a>
        <div class="dropdown-menu font-settings dropdown-left">
            <div class="dropdown-caret">
                <span class="caret-outer"></span>
                <span class="caret-inner"></span>
            </div>
            <div class="buttons">
                <button type="button" data-sharing="twitter" class="button">
                    Share on Twitter
                </button>
                <button type="button" data-sharing="google-plus" class="button">
                    Share on Google
                </button>
                <button type="button" data-sharing="facebook" class="button">
                    Share on Facebook
                </button>
                <button type="button" data-sharing="weibo" class="button">
                    Share on Weibo
                </button>
                <button type="button" data-sharing="instapaper" class="button">
                    Share on Instapaper
                </button>
            </div>
        </div>
    </div>
    

    
    <a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Google"><i class="fa fa-google-plus"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Facebook"><i class="fa fa-facebook"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Twitter"><i class="fa fa-twitter"></i></a>
    
    
    


    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >Swift 简介</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="%E6%8E%A7%E5%88%B6%E6%B5%81">&#x63A7;&#x5236;&#x6D41;</h1>
<h2 id="if">if</h2>
<ul>
<li>Swift &#x4E2D;&#x6CA1;&#x6709; C &#x8BED;&#x8A00;&#x4E2D;&#x7684;<code>&#x975E;&#x96F6;&#x5373;&#x771F;</code>&#x6982;&#x5FF5;</li>
<li>&#x5728;&#x903B;&#x8F91;&#x5224;&#x65AD;&#x65F6;&#x5FC5;&#x987B;&#x663E;&#x793A;&#x5730;&#x6307;&#x660E;&#x5177;&#x4F53;&#x7684;&#x5224;&#x65AD;&#x6761;&#x4EF6;</li>
<li>if &#x8BED;&#x53E5;&#x6761;&#x4EF6;&#x7684; <code>()</code> &#x53EF;&#x4EE5;&#x7701;&#x7565;</li>
<li>&#x4F46;&#x662F; <code>{}</code> &#x4E0D;&#x80FD;&#x7701;&#x7565;</li>
</ul>
<pre><code class="lang-swift"><span class="hljs-keyword">let</span> num = <span class="hljs-number">200</span>
<span class="hljs-keyword">if</span> num &lt; <span class="hljs-number">10</span> {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x6BD4; 10 &#x5C0F;&quot;</span>)
} <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> num &gt; <span class="hljs-number">100</span> {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x6BD4; 100 &#x5927;&quot;</span>)
} <span class="hljs-keyword">else</span> {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;10 ~ 100 &#x4E4B;&#x95F4;&#x7684;&#x6570;&#x5B57;&quot;</span>)
}
</code></pre>
<h3 id="%E4%B8%89%E7%9B%AE%E8%BF%90%E7%AE%97">&#x4E09;&#x76EE;&#x8FD0;&#x7B97;</h3>
<ul>
<li>Swift &#x4E2D;&#x7684; <code>&#x4E09;&#x76EE;</code> &#x8FD0;&#x7B97;&#x4FDD;&#x6301;&#x4E86;&#x548C; OC &#x4E00;&#x81F4;&#x7684;&#x98CE;&#x683C;</li>
</ul>
<pre><code class="lang-swift"><span class="hljs-keyword">var</span> a = <span class="hljs-number">10</span>
<span class="hljs-keyword">var</span> b = <span class="hljs-number">20</span>
<span class="hljs-keyword">let</span> <span class="hljs-built_in">c</span> = a &gt; b ? a : b
<span class="hljs-built_in">print</span>(<span class="hljs-built_in">c</span>)
</code></pre>
<blockquote>
<p>&#x9002;&#x5F53;&#x5730;&#x8FD0;&#x7528;&#x4E09;&#x76EE;&#xFF0C;&#x80FD;&#x591F;&#x8BA9;&#x4EE3;&#x7801;&#x5199;&#x5F97;&#x66F4;&#x52A0;&#x7B80;&#x6D01;</p>
</blockquote>
<h3 id="%E5%8F%AF%E9%80%89%E9%A1%B9%E5%88%A4%E6%96%AD">&#x53EF;&#x9009;&#x9879;&#x5224;&#x65AD;</h3>
<ul>
<li>&#x7531;&#x4E8E;&#x53EF;&#x9009;&#x9879;&#x7684;&#x5185;&#x5BB9;&#x53EF;&#x80FD;&#x4E3A; <code>nil</code>&#xFF0C;&#x800C;&#x4E00;&#x65E6;&#x4E3A; <code>nil</code> &#x5219;&#x4E0D;&#x5141;&#x8BB8;&#x53C2;&#x4E0E;&#x8BA1;&#x7B97;</li>
<li>&#x56E0;&#x6B64;&#x5728;&#x5B9E;&#x9645;&#x5F00;&#x53D1;&#x4E2D;&#xFF0C;&#x7ECF;&#x5E38;&#x9700;&#x8981;&#x5224;&#x65AD;&#x53EF;&#x9009;&#x9879;&#x7684;&#x5185;&#x5BB9;&#x662F;&#x5426;&#x4E3A; <code>nil</code></li>
</ul>
<h4 id="%E5%8D%95%E4%B8%AA%E5%8F%AF%E9%80%89%E9%A1%B9%E5%88%A4%E6%96%AD">&#x5355;&#x4E2A;&#x53EF;&#x9009;&#x9879;&#x5224;&#x65AD;</h4>
<pre><code class="lang-swift"><span class="hljs-keyword">let</span> url = <span class="hljs-type">NSURL</span>(string: <span class="hljs-string">&quot;http://www.baidu.com&quot;</span>)

<span class="hljs-comment">//: &#x65B9;&#x6CD5;1: &#x5F3A;&#x884C;&#x89E3;&#x5305; - &#x7F3A;&#x9677;&#xFF0C;&#x5982;&#x679C; url &#x4E3A;&#x7A7A;&#xFF0C;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x5D29;&#x6E83;</span>
<span class="hljs-keyword">let</span> request = <span class="hljs-type">NSURLRequest</span>(<span class="hljs-type">URL</span>: url!)

<span class="hljs-comment">//: &#x65B9;&#x6CD5;2: &#x9996;&#x5148;&#x5224;&#x65AD; - &#x4EE3;&#x7801;&#x4E2D;&#x4ECD;&#x7136;&#x9700;&#x8981;&#x4F7F;&#x7528; `!` &#x5F3A;&#x884C;&#x89E3;&#x5305;</span>
<span class="hljs-keyword">if</span> url != <span class="hljs-built_in">nil</span> {
    <span class="hljs-keyword">let</span> request = <span class="hljs-type">NSURLRequest</span>(<span class="hljs-type">URL</span>: url!)
}

<span class="hljs-comment">//: &#x65B9;&#x6CD5;3: &#x4F7F;&#x7528; `if let`&#xFF0C;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x8868;&#x660E;&#x4E00;&#x65E6;&#x8FDB;&#x5165; if &#x5206;&#x652F;&#xFF0C;u &#x5C31;&#x4E0D;&#x5728;&#x662F;&#x53EF;&#x9009;&#x9879;</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> u = url <span class="hljs-keyword">where</span> u.host == <span class="hljs-string">&quot;www.baidu.com&quot;</span> {
    <span class="hljs-keyword">let</span> request = <span class="hljs-type">NSURLRequest</span>(<span class="hljs-type">URL</span>: u)
}
</code></pre>
<h4 id="%E5%8F%AF%E9%80%89%E9%A1%B9%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD">&#x53EF;&#x9009;&#x9879;&#x6761;&#x4EF6;&#x5224;&#x65AD;</h4>
<pre><code class="lang-swift"><span class="hljs-comment">//: 1&gt; &#x521D;&#x5B66; swift &#x4E00;&#x4E0D;&#x5C0F;&#x5FC3;&#x5C31;&#x4F1A;&#x8BA9; if &#x7684;&#x5D4C;&#x5957;&#x5C42;&#x6B21;&#x5F88;&#x6DF1;&#xFF0C;&#x8BA9;&#x4EE3;&#x7801;&#x53D8;&#x5F97;&#x5F88;&#x4E11;&#x964B;</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> u = url {
    <span class="hljs-keyword">if</span> u.host == <span class="hljs-string">&quot;www.baidu.com&quot;</span> {
        <span class="hljs-keyword">let</span> request = <span class="hljs-type">NSURLRequest</span>(<span class="hljs-type">URL</span>: u)
    }
}

<span class="hljs-comment">//: 2&gt; &#x4F7F;&#x7528; where &#x5173;&#x952E;&#x5B57;&#xFF0C;</span>
<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> u = url <span class="hljs-keyword">where</span> u.host == <span class="hljs-string">&quot;www.baidu.com&quot;</span> {
    <span class="hljs-keyword">let</span> request = <span class="hljs-type">NSURLRequest</span>(<span class="hljs-type">URL</span>: u)
}
</code></pre>
<ul>
<li>&#x5C0F;&#x7ED3;<ul>
<li><code>if let</code> &#x4E0D;&#x80FD;&#x4E0E;&#x4F7F;&#x7528; <code>&amp;</code>&#x3001;<code>|</code> &#x7B49;&#x6761;&#x4EF6;&#x5224;&#x65AD;</li>
<li>&#x5982;&#x679C;&#x8981;&#x589E;&#x52A0;&#x6761;&#x4EF6;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>where</code> &#x5B50;&#x53E5;</li>
<li>&#x6CE8;&#x610F;&#xFF1A;<code>where</code> &#x5B50;&#x53E5;&#x6CA1;&#x6709;&#x667A;&#x80FD;&#x63D0;&#x793A;</li>
</ul>
</li>
</ul>
<h4 id="%E5%A4%9A%E4%B8%AA%E5%8F%AF%E9%80%89%E9%A1%B9%E5%88%A4%E6%96%AD">&#x591A;&#x4E2A;&#x53EF;&#x9009;&#x9879;&#x5224;&#x65AD;</h4>
<pre><code class="lang-swift"><span class="hljs-comment">//: 3&gt; &#x53EF;&#x4EE5;&#x4F7F;&#x7528; `,` &#x540C;&#x65F6;&#x5224;&#x65AD;&#x591A;&#x4E2A;&#x53EF;&#x9009;&#x9879;&#x662F;&#x5426;&#x4E3A;&#x7A7A;</span>
<span class="hljs-keyword">let</span> oName: <span class="hljs-type">String</span>? = <span class="hljs-string">&quot;&#x5F20;&#x4E09;&quot;</span>
<span class="hljs-keyword">let</span> oNo: <span class="hljs-type">Int</span>? = <span class="hljs-number">100</span>

<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> name = oName {
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> no = oNo {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x59D3;&#x540D;:&quot;</span> + name + <span class="hljs-string">&quot; &#x5B66;&#x53F7;: &quot;</span> + <span class="hljs-type">String</span>(no))
    }
}

<span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> name = oName, <span class="hljs-keyword">let</span> no = oNo {
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x59D3;&#x540D;:&quot;</span> + name + <span class="hljs-string">&quot; &#x5B66;&#x53F7;: &quot;</span> + <span class="hljs-type">String</span>(no))
}
</code></pre>
<h2 id="switch">switch</h2>
<ul>
<li><code>switch</code> &#x4E0D;&#x518D;&#x5C40;&#x9650;&#x4E8E;&#x6574;&#x6570;</li>
<li><code>switch</code> &#x53EF;&#x4EE5;&#x9488;&#x5BF9;<code>&#x4EFB;&#x610F;&#x6570;&#x636E;&#x7C7B;&#x578B;</code>&#x8FDB;&#x884C;&#x5224;&#x65AD;</li>
<li>&#x4E0D;&#x518D;&#x9700;&#x8981; <code>break</code></li>
<li>&#x6BCF;&#x4E00;&#x4E2A; <code>case</code>&#x540E;&#x9762;&#x5FC5;&#x987B;&#x6709;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;</li>
<li>&#x8981;&#x4FDD;&#x8BC1;&#x5904;&#x7406;&#x6240;&#x6709;&#x53EF;&#x80FD;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x4E0D;&#x7136;&#x7F16;&#x8BD1;&#x5668;&#x76F4;&#x63A5;&#x62A5;&#x9519;&#xFF0C;&#x4E0D;&#x5904;&#x7406;&#x7684;&#x6761;&#x4EF6;&#x53EF;&#x4EE5;&#x653E;&#x5728; <code>default</code> &#x5206;&#x652F;&#x4E2D;</li>
<li>&#x6BCF;&#x4E00;&#x4E2A; <code>case</code> &#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#x53D8;&#x91CF;&#x4EC5;&#x5728;&#x5F53;&#x524D; <code>case</code> &#x4E2D;&#x6709;&#x6548;&#xFF0C;&#x800C; OC &#x4E2D;&#x9700;&#x8981;&#x4F7F;&#x7528; <code>{}</code></li>
</ul>
<pre><code class="lang-swift"><span class="hljs-keyword">let</span> score = <span class="hljs-string">&quot;A&quot;</span>
<span class="hljs-keyword">switch</span> score {
<span class="hljs-keyword">case</span> <span class="hljs-string">&quot;A&quot;</span>, <span class="hljs-string">&quot;B&quot;</span>, <span class="hljs-string">&quot;C&quot;</span>:
    <span class="hljs-keyword">let</span> name = <span class="hljs-string">&quot;&#x5F20;&#x4E09;&quot;</span>
    <span class="hljs-built_in">print</span>(name + <span class="hljs-string">&quot;&#x53CA;&#x683C;&quot;</span>)
<span class="hljs-keyword">case</span> <span class="hljs-string">&quot;D&quot;</span>, <span class="hljs-string">&quot;E&quot;</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x4E0D;&#x53CA;&#x683C;&quot;</span>)
<span class="hljs-keyword">default</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&quot;</span>)
}
</code></pre>
<ul>
<li>switch &#x4E2D;&#x540C;&#x6837;&#x80FD;&#x591F;&#x8D4B;&#x503C;&#x548C;&#x4F7F;&#x7528; <code>where</code> &#x5B50;&#x53E5;</li>
</ul>
<pre><code class="lang-swift"><span class="hljs-keyword">let</span> point = <span class="hljs-type">CGPoint</span>(x: <span class="hljs-number">10</span>, y: <span class="hljs-number">10</span>)
<span class="hljs-keyword">switch</span> point {
<span class="hljs-keyword">case</span> <span class="hljs-keyword">let</span> p <span class="hljs-keyword">where</span> p.x == <span class="hljs-number">0</span> &amp;&amp; p.y == <span class="hljs-number">0</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x4E2D;&#x5FC3;&#x70B9;&quot;</span>)
<span class="hljs-keyword">case</span> <span class="hljs-keyword">let</span> p <span class="hljs-keyword">where</span> p.x == <span class="hljs-number">0</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Y&#x8F74;&quot;</span>)
<span class="hljs-keyword">case</span> <span class="hljs-keyword">let</span> p <span class="hljs-keyword">where</span> p.y == <span class="hljs-number">0</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;X&#x8F74;&quot;</span>)
<span class="hljs-keyword">case</span> <span class="hljs-keyword">let</span> p <span class="hljs-keyword">where</span> <span class="hljs-built_in">abs</span>(p.x) == <span class="hljs-built_in">abs</span>(p.y):
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x5BF9;&#x89D2;&#x7EBF;&quot;</span>)
<span class="hljs-keyword">default</span>:
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&quot;</span>)
}
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./03-optional.html" class="navigation navigation-prev " aria-label="Previous page: Optional可选值"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./05-loop.html" class="navigation navigation-next " aria-label="Next page: 循环"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

<script>
require(["gitbook"], function(gitbook) {
    var config = {"fontSettings":{"theme":null,"family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
